1. Field of the Invention
This invention relates to an arithmetic device, and more particularly to an arithmetic device capable of single-instruction/multiple-data (SIMD) computing.
2. Description of the Related Art
When SIMD computing which enables a parallel arithmetical operation to be performed on a plurality of items of data with a single instruction is done, the items of data have to be rearranged to carry out a parallel operation on the data read from the memory. If a plurality of cycles are needed for the rearrangement of the data, the time during which the SIMD computing unit is idle increases, which prevents the original performance of the SIMD computing unit from being brought out sufficiently.
A processor capable of SIMD computing is often provided with not only arithmetic instructions but also data rearrangement instructions. Prepared instructions, however, are restricted to simple patterns because of a limitation on the number of instructions. For this reason, when a complex rearrangement inapplicable to the patterns is made, a large number of cycles are needed.
For example, in a case where the following data items have been stored in 64-bit (or 8-byte) general-purpose registers $1, $2, the data items in the two registers are merged alternately to store the resulting data in general-purpose register $0 as follows:
$1: D10, D11, D12, D13
$2: D20, D21, D22, D23
$0: D10, D20, D11, D21
In this case, as shown in program (1) below, for example, 12 instructions have to be executed:
                              Instruction          //                      Description            ⁢                                                  ⁢            of            ⁢                                                  ⁢            general            ⁢                          -                        ⁢            purpose            ⁢                                                  ⁢            register                          ⁢                                  ⁢                              1            ⁢                                                  ⁢                          SRL              .              H                        ⁢                                                  ⁢            $3                    ,          $1          ,                                    3              //              $3                        =                                          {                                  0                  ,                  0                  ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    10                                                  }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $1              ⁢                                                          ⁢              right              ⁢                                                          ⁢              3              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                                                ⁢                                                                              ⁢              in              ⁢                                                          ⁢              $3                                      ⁢                                  ⁢                              2            ⁢                                                  ⁢                          SLL              .              H                        ⁢                                                  ⁢            $3                    ,          $3          ,                                    3              //              $3                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    10                                    ,                  0                  ,                  0                  ,                  0                                }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢                              shif                ⁢                t                            ⁢                                                          ⁢              $3              ⁢                                                          ⁢              left              ⁢                                                          ⁢              3              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $3                                      ⁢                                  ⁢                              3            ⁢                                                  ⁢                          SLL              .              H                        ⁢                                                  ⁢            $4                    ,          $1          ,                                    1              //              $4                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    11                                    ,                                      D                    ⁢                                                                                  ⁢                    12                                    ,                                      D                    ⁢                                                                                  ⁢                    13                                    ,                  0                                }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $1              ⁢                                                          ⁢              left              ⁢                                                          ⁢              1              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $4                                      ⁢                                  ⁢                              4            ⁢                                                  ⁢                          SRL              .              H                        ⁢                                                  ⁢            $4                    ,          $4          ,                                    3              //              $4                        =                                          {                                  0                  ,                  0                  ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    11                                                  }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $4              ⁢                                                          ⁢              right              ⁢                                                          ⁢              3              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $4                                      ⁢                                  ⁢                              5            ⁢                                                  ⁢                          SLL              .              H                        ⁢                                                  ⁢            $4                    ,          $4          ,                                    1              //              $4                        =                                          {                                  0                  ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    11                                    ,                  0                                }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $4              ⁢                                                          ⁢              left              ⁢                                                          ⁢              1              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $4                                      ⁢                                  ⁢                              6            ⁢                                                  ⁢                          SRL              .              H                        ⁢                                                  ⁢            $5                    ,          $2          ,                                    3              //              $5                        =                                          {                                  0                  ,                  0                  ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    21                                                  }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $2              ⁢                                                          ⁢              right              ⁢                                                          ⁢              3              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $5                                      ⁢                                  ⁢                              7            ⁢                                                  ⁢                          SLL              .              H                        ⁢                                                  ⁢            $5                    ,          $5          ,                                    2              //              $5                        =                                          {                                  0                  ,                                      D                    ⁢                                                                                  ⁢                    20                                    ,                  0                  ,                  0                                }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $5              ⁢                                                          ⁢              left              ⁢                                                          ⁢              2              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $5                                      ⁢                                  ⁢                              8            ⁢                                                  ⁢                          SLL              .              H                        ⁢                                                  ⁢            $6                    ,          $2          ,                                    1              //              $6                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    21                                    ,                                      D                    ⁢                                                                                  ⁢                    22                                    ,                                      D                    ⁢                                                                                  ⁢                    23                                    ,                  0                                }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $2              ⁢                                                          ⁢              left              ⁢                                                          ⁢              1              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $6                                      ⁢                                  ⁢                              9            ⁢                                                  ⁢                          SRL              .              H                        ⁢                                                  ⁢            $6                    ,          $6          ,                                    3              //              $6                        =                                          {                                  0                  ,                  0                  ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    21                                                  }                            ⁢                                                          ⁢              Logically              ⁢                                                          ⁢              shift              ⁢                                                          ⁢              $6              ⁢                                                          ⁢              right              ⁢                                                          ⁢              3              ⁢              HW              ⁢                                                          ⁢              and              ⁢                                                          ⁢              store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $6                                      ⁢                                  ⁢                              10            ⁢                                                  ⁢                          OR              .              H                        ⁢                                                  ⁢            $0                    ,          $3          ,                                    $4              //              $0                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    10                                    ,                  0                  ,                                      D                    ⁢                                                                                  ⁢                    11                                    ,                  0                                }                            ⁢                                                          ⁢              Store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              of              ⁢                                                          ⁢              ORing              ⁢                                                          ⁢              $3              ⁢                                                          ⁢              and              ⁢                                                          ⁢              $4              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $0                                      ⁢                                  ⁢                              11            ⁢                                                  ⁢                          OR              .              H                        ⁢                                                  ⁢            $0                    ,          $0          ,                                    $5              //              $0                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    10                                    ,                                      D                    ⁢                                                                                  ⁢                    20                                    ,                                      D                    ⁢                                                                                  ⁢                    11                                    ,                  0                                }                            ⁢                                                          ⁢              Store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              of              ⁢                                                          ⁢              ORing              ⁢                                                          ⁢              $0              ⁢                                                          ⁢              and              ⁢                                                          ⁢              $5              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $0                                      ⁢                                  ⁢                              12            ⁢                                                  ⁢                          OR              .              H                        ⁢                                                  ⁢            $0                    ,          $0          ,                                    $6              //              $0                        =                                          {                                                      D                    ⁢                                                                                  ⁢                    10                                    ,                                      D                    ⁢                                                                                  ⁢                    20                                    ,                                      D                    ⁢                                                                                  ⁢                    11                                    ,                                      D                    ⁢                                                                                  ⁢                    21                                                  }                            ⁢                                                          ⁢              Store              ⁢                                                          ⁢              the              ⁢                                                          ⁢              result              ⁢                                                          ⁢              of              ⁢                                                          ⁢              ORing              ⁢                                                          ⁢              $0              ⁢                                                          ⁢              and              ⁢                                                          ⁢              $6              ⁢                                                          ⁢              in              ⁢                                                          ⁢              $0                                                          (        1        )            
If SIMD computing is done using the result of the rearrangement, SIMD computing can be performed only once for every 13 instructions. Accordingly, the improvement of the parallelization by SIMD computing is not used sufficiently.
To overcome this problem, the introduction of a plurality of rearrangement instructions can be considered (for example, Jpn. Pat. Appln. KOKAI Publication No. 2001-344099). However, if a plurality of rearrangement instructions are provided, the area of the decode circuit for decoding instructions increases, reducing a margin for the execution timing, which makes the control more difficult.
One known technique is to execute a complex rearrangement pattern with a reconfigurable array. However, when the reconfigurable array is applied to a small-scale circuit, its occupied area in the chip is large, resulting in a low cost performance problem.
Furthermore, the following technique has been developed: rearrangement parameters are stored in a plurality of control registers; these parameters are selected by a control block and supplied to a rearrangement logical block 120; and then, the rearrangement logical block 120 rearranges the data in a vector register file 110 (for example, Japanese Unexamined Patent Application Publication No. 2006-504165).
However, when the unit of data rearrangement becomes larger, the storage area of the register which stores the rearrangement pattern data becomes smaller. In this way, when the storage area becomes smaller, an unused part develops in the register, preventing the storage area of the register from being used effectively.
For this reason, an arithmetic device capable of making effective use of the storage area for storing rearrangement pattern data has been desired.